<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  

  
  <title>wxPay | Threadv</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="微信支付 生成订单  123456789101112131415161718//微信下单支付String appid = MyEnv.env.getProperty(&quot;appid&quot;);String mch_id = MyEnv.env.getProperty(&quot;mch_id&quot;);">
<meta name="keywords" content="支付转账">
<meta property="og:type" content="article">
<meta property="og:title" content="wxPay">
<meta property="og:url" content="http://yoursite.com/2018/11/06/微信支付/index.html">
<meta property="og:site_name" content="Threadv">
<meta property="og:description" content="微信支付 生成订单  123456789101112131415161718//微信下单支付String appid = MyEnv.env.getProperty(&quot;appid&quot;);String mch_id = MyEnv.env.getProperty(&quot;mch_id&quot;);String wxkey = env.getProperty(&quot;wxkey&quot;);//回调地址String callBac">
<meta property="og:updated_time" content="2020-03-29T11:01:38.448Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="wxPay">
<meta name="twitter:description" content="微信支付 生成订单  123456789101112131415161718//微信下单支付String appid = MyEnv.env.getProperty(&quot;appid&quot;);String mch_id = MyEnv.env.getProperty(&quot;mch_id&quot;);String wxkey = env.getProperty(&quot;wxkey&quot;);//回调地址String callBac">
  
    <link rel="alternate" href="/atom.xml" title="Threadv" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Threadv</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-微信支付" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2018/11/06/微信支付/" class="article-date">
  <time datetime="2018-11-06T02:20:26.000Z" itemprop="datePublished">2018-11-06</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      wxPay
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h5 id="微信支付"><a href="#微信支付" class="headerlink" title="微信支付"></a>微信支付</h5><ul>
<li>生成订单</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//微信下单支付</span></span><br><span class="line">String appid = MyEnv.env.getProperty(<span class="string">"appid"</span>);</span><br><span class="line">String mch_id = MyEnv.env.getProperty(<span class="string">"mch_id"</span>);</span><br><span class="line">String wxkey = env.getProperty(<span class="string">"wxkey"</span>);</span><br><span class="line"><span class="comment">//回调地址</span></span><br><span class="line">String callBackUrl = env.getProperty(<span class="string">"shopWeixinPay.notify"</span>);</span><br><span class="line">String outTradeNo = env.getProperty(<span class="string">"shopOrder.prefix"</span>) + <span class="string">"_"</span> + shopOrder.getId();</span><br><span class="line"></span><br><span class="line">String wapUrl = env.getProperty(<span class="string">"shopWechatPayWapUrl"</span>);</span><br><span class="line">String sceneInfo = <span class="string">"&#123;\"h5_info\": &#123;\"type\":\"Wap\",\"wap_url\": \""</span> + wapUrl + <span class="string">"\",\"wap_name\": \"xxxx商城\"&#125;&#125;"</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">//下单</span></span><br><span class="line">JSONObject jsonObject = weiXinOrderService.doUnifiedOrder(outTradeNo, <span class="string">"xxx商城订单"</span>, shopOrder.getTotalAmount(), shopOrder.getGoodsId().toString(), request, <span class="keyword">null</span>, wxkey, callBackUrl, <span class="string">"MWEB"</span>, sceneInfo, appid, mch_id);</span><br><span class="line">Map jsonMap = JSONObject.fromObject(jsonObject);</span><br><span class="line">String webUrl = jsonMap.get(<span class="string">"mweb_url"</span>).toString();</span><br><span class="line">String redirect = env.getProperty(<span class="string">"shopOrder.success.url"</span>) + shopOrder.getId();</span><br><span class="line">String wechatPayUrl = webUrl + <span class="string">"&amp;redirect_url="</span> + URLEncoder.encode(redirect, <span class="string">"utf-8"</span>);</span><br><span class="line">response.setWebUrl(wechatPayUrl);</span><br></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 扫码支付  下单返回信息</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="meta">@Override</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> JSONObject <span class="title">doUnifiedOrder</span><span class="params">(String outTradeNo, String goodsName, Integer goodsPrice, String goodsId, HttpServletRequest request, String openId, String wxkey, String callBackUrl, String tradeType, String sceneInfo, String appId, String mchId)</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    String ip = HttpRequest.getIpAddr(request);</span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        JSONObject jsonObject = <span class="keyword">this</span>.doUnifiedOrderWx(outTradeNo, goodsName, goodsPrice, goodsId,ip,openId,wxkey, callBackUrl, tradeType, sceneInfo, appId, mchId);</span><br><span class="line">        <span class="keyword">return</span> jsonObject;</span><br><span class="line">    &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line">        e.printStackTrace();</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">null</span>;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">  <span class="meta">@Override</span></span><br><span class="line"><span class="function"><span class="keyword">public</span> JSONObject <span class="title">doUnifiedOrderWx</span><span class="params">(String outTradeNo, String goodsName, Integer goodsPrice, String goodsId,String ip,String openId,String wxkey, String callBackUrl, String tradeType, String sceneInfo, String appId, String mchId)</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        <span class="comment">//证书文件</span></span><br><span class="line">        String certpath = env.getProperty(<span class="string">"certPath"</span>);</span><br><span class="line">        config = WXPayConfigImpl.getInstance(certpath, appId, mchId);</span><br><span class="line">        wxpay = <span class="keyword">new</span> WXPay(config);</span><br><span class="line">    &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line">        e.printStackTrace();</span><br><span class="line">    &#125;</span><br><span class="line">    HashMap&lt;String, String&gt; data = <span class="keyword">new</span> HashMap&lt;String, String&gt;();</span><br><span class="line">    data.put(<span class="string">"body"</span>, goodsName);</span><br><span class="line">    data.put(<span class="string">"out_trade_no"</span>, outTradeNo);</span><br><span class="line">    data.put(<span class="string">"fee_type"</span>, <span class="string">"CNY"</span>);</span><br><span class="line">    data.put(<span class="string">"device_info"</span>, <span class="string">""</span>);</span><br><span class="line">    data.put(<span class="string">"total_fee"</span>, goodsPrice.toString());</span><br><span class="line">    data.put(<span class="string">"spbill_create_ip"</span>, ip);</span><br><span class="line">    data.put(<span class="string">"notify_url"</span>, callBackUrl);</span><br><span class="line">    data.put(<span class="string">"trade_type"</span>, tradeType);</span><br><span class="line">    data.put(<span class="string">"product_id"</span>, goodsId);</span><br><span class="line">    <span class="keyword">if</span>(openId != <span class="keyword">null</span>)&#123;</span><br><span class="line">        data.put(<span class="string">"openid"</span>, openId);</span><br><span class="line">    &#125;</span><br><span class="line">    data.put(<span class="string">"scene_info"</span>, sceneInfo);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">try</span> &#123;</span><br><span class="line">        <span class="keyword">long</span> timeMillis = System.currentTimeMillis();</span><br><span class="line">        Long timeStamp = (timeMillis/<span class="number">1000</span>);</span><br><span class="line">        Map&lt;String, String&gt; map = wxpay.unifiedOrder(data);</span><br><span class="line">        logger.info(map);</span><br><span class="line">        String appid = map.get(<span class="string">"appid"</span>);</span><br><span class="line">        String nonce_str = map.get(<span class="string">"nonce_str"</span>);</span><br><span class="line">        String prepay_id = map.get(<span class="string">"prepay_id"</span>);</span><br><span class="line"></span><br><span class="line">        String sign= <span class="string">"appId="</span>+appid+<span class="string">"&amp;nonceStr="</span>+nonce_str+<span class="string">"&amp;package=prepay_id="</span>+prepay_id+<span class="string">"&amp;signType=MD5"</span>+<span class="string">"&amp;timeStamp="</span>+timeStamp+<span class="string">"&amp;key="</span>+ wxkey;</span><br><span class="line">        System.out.println(sign);</span><br><span class="line">        String jsSign= MD5Util.MD5Encode(sign,<span class="string">"utf-8"</span>).toUpperCase();</span><br><span class="line"></span><br><span class="line">        map.put(<span class="string">"jsSign"</span>,jsSign);</span><br><span class="line">        map.put(<span class="string">"timeStamp"</span>,timeStamp.toString());<span class="comment">//当前时间戳</span></span><br><span class="line">        System.out.println(map);</span><br><span class="line">        <span class="keyword">return</span> JSONObject.fromObject(map);</span><br><span class="line">    &#125; <span class="keyword">catch</span> (Exception e) &#123;</span><br><span class="line">        e.printStackTrace();</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> <span class="keyword">null</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>h5发起微信支付</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">onBridgeReady</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line">									WeixinJSBridge.invoke(</span><br><span class="line">										<span class="string">'getBrandWCPayRequest'</span>, &#123;</span><br><span class="line">											<span class="string">"appId"</span>: res.body.jsonObject.appid, <span class="comment">//公众号名称，由商户传入     </span></span><br><span class="line">											<span class="string">"timeStamp"</span>: res.body.jsonObject.timeStamp, <span class="comment">// 时间戳，自1970年以来的秒数     </span></span><br><span class="line">											<span class="string">"nonceStr"</span>: res.body.jsonObject.nonce_str, <span class="comment">//随机串     </span></span><br><span class="line">											<span class="string">"package"</span>: <span class="string">"prepay_id="</span> + res.body.jsonObject.prepay_id,</span><br><span class="line">											<span class="string">"signType"</span>: <span class="string">"MD5"</span>, <span class="comment">//微信签名方式：     </span></span><br><span class="line">											<span class="string">"paySign"</span>: res.body.jsonObject.jsSign <span class="comment">//微信签名</span></span><br><span class="line">										&#125;,</span><br><span class="line">										<span class="function"><span class="keyword">function</span>(<span class="params">resp</span>) </span>&#123;</span><br><span class="line"></span><br><span class="line">											<span class="keyword">if</span>(resp.err_msg == <span class="string">"get_brand_wcpay_request:ok"</span>) &#123;</span><br><span class="line">												<span class="comment">//																alert('成功' +self.vipcode )</span></span><br><span class="line">												<span class="built_in">window</span>.location.href = <span class="string">"../success/success.html?orderid="</span> + self.orderid;</span><br><span class="line">											&#125; <span class="comment">// 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。</span></span><br><span class="line">											<span class="keyword">else</span> <span class="keyword">if</span>(resp.err_msg == <span class="string">"get_brand_wcpay_request:cancel"</span>) &#123;</span><br><span class="line">												self.showSelect = <span class="literal">false</span></span><br><span class="line">												self.selectActive = <span class="literal">true</span></span><br><span class="line">											&#125; <span class="keyword">else</span> &#123;</span><br><span class="line">												<span class="comment">//								alert(resp.err_msg)</span></span><br><span class="line">											&#125;</span><br><span class="line">										&#125;</span><br><span class="line">									);</span><br><span class="line">								&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li><p>回调</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">@CrossOrigin</span></span><br><span class="line"><span class="meta">@RequestMapping</span>(value = <span class="string">"/WxPayNotify"</span>, method = RequestMethod.POST)</span><br><span class="line"><span class="meta">@ResponseBody</span></span><br><span class="line"><span class="meta">@ApiOperation</span>(value = <span class="string">"回调地址"</span>, notes = <span class="string">"微信支付回调地址"</span>)</span><br><span class="line"><span class="meta">@ApiResponses</span>(&#123;<span class="meta">@ApiResponse</span>(code = <span class="number">1</span>, message = <span class="string">"成功"</span>, response = GetUserResponse.class)</span><br><span class="line">        , <span class="meta">@ApiResponse</span>(code = <span class="number">201</span>, message = <span class="string">"没有找到这个用户"</span>, response = ExceptionResponse.class)&#125;)</span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">wxpayNotify</span><span class="params">(</span></span></span><br><span class="line"><span class="function"><span class="params">)</span> <span class="keyword">throws</span> IOException, ApiException </span>&#123;</span><br><span class="line">    logger.info(<span class="string">"--- start wxpaynotify ---"</span>);</span><br><span class="line">    String prefix = MyEnv.env.getProperty(<span class="string">"shopOrder.prefix"</span>);</span><br><span class="line">    WeixinNotify wxNotify = <span class="keyword">new</span> WeixinNotify(request, prefix);</span><br><span class="line">    String appid = MyEnv.env.getProperty(<span class="string">"appid"</span>);</span><br><span class="line">    String wxkey = MyEnv.env.getProperty(<span class="string">"wxkey"</span>);</span><br><span class="line">    String mch_id = MyEnv.env.getProperty(<span class="string">"mch_id"</span>);</span><br><span class="line">    <span class="keyword">boolean</span> flagSign = wxNotify.checkWeixinSign(wxNotify, appid, wxkey, mch_id);</span><br><span class="line">    logger.info(<span class="string">"flagSign"</span> + flagSign);</span><br><span class="line">    <span class="comment">//验签成功</span></span><br><span class="line">    <span class="keyword">if</span> (flagSign) &#123;</span><br><span class="line">        <span class="comment">//处理业务</span></span><br><span class="line">        <span class="comment">//...</span></span><br><span class="line">        <span class="keyword">int</span> orderId = wxNotify.getOrderId().intValue();</span><br><span class="line">       </span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p>验签</p>
</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br></pre></td><td class="code"><pre><span class="line">   </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">WeixinNotify</span></span>&#123;</span><br><span class="line">    Logger logger = Logger.getLogger(WeixinNotify.class);</span><br><span class="line">    <span class="keyword">public</span> String orderIdstr;</span><br><span class="line">    Long orderId;</span><br><span class="line">    String payAccount;</span><br><span class="line">    String xmlDoc;</span><br><span class="line">    Element root;</span><br><span class="line">    String tradeNo;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">WeixinNotify</span><span class="params">(HttpServletRequest request)</span> <span class="keyword">throws</span> IOException, ApiNotFoundException </span>&#123;</span><br><span class="line">        InputStream inStream = request.getInputStream();</span><br><span class="line">        ByteArrayOutputStream outSteam = <span class="keyword">new</span> ByteArrayOutputStream();</span><br><span class="line">        <span class="keyword">byte</span>[] buffer = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">1024</span>];</span><br><span class="line">        <span class="keyword">int</span> len = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">while</span> ((len = inStream.read(buffer)) != -<span class="number">1</span>) &#123;</span><br><span class="line">            outSteam.write(buffer, <span class="number">0</span>, len);</span><br><span class="line">        &#125;</span><br><span class="line">        outSteam.close();</span><br><span class="line">        inStream.close();</span><br><span class="line">        <span class="keyword">this</span>.xmlDoc  = <span class="keyword">new</span> String(outSteam.toByteArray(),<span class="string">"utf-8"</span>);</span><br><span class="line">        logger.info(<span class="keyword">this</span>.xmlDoc);</span><br><span class="line"></span><br><span class="line">        StringReader read = <span class="keyword">new</span> StringReader(xmlDoc);</span><br><span class="line">        InputSource source = <span class="keyword">new</span> InputSource(read);</span><br><span class="line">        SAXBuilder sb = <span class="keyword">new</span> SAXBuilder();</span><br><span class="line">        Document doc = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            doc = sb.build(source);</span><br><span class="line">        &#125; <span class="keyword">catch</span> (JDOMException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="comment">//取的根元素</span></span><br><span class="line">        root = doc.getRootElement();</span><br><span class="line">        <span class="comment">//            System.out.println(root.getName());//输出根元素的名称（测试）</span></span><br><span class="line">        Namespace ns = root.getNamespace();</span><br><span class="line"></span><br><span class="line">        <span class="comment">//获取 orderId</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//            logger.info("--------------------wxpayNotify----prefix----"+prefix);</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">this</span>.orderIdstr= root.getChild(<span class="string">"out_trade_no"</span>,ns).getText();</span><br><span class="line">        <span class="keyword">this</span>.payAccount = root.getChild(<span class="string">"openid"</span>,ns).getText();</span><br><span class="line">        <span class="keyword">this</span>.tradeNo= root.getChild(<span class="string">"transaction_id"</span>,ns).getText();</span><br><span class="line"></span><br><span class="line">        <span class="comment">//可以从订单号中区分 是单行本 还是  app</span></span><br><span class="line">        String prefix= MyEnv.env.getProperty(<span class="string">"order.prefix"</span>);</span><br><span class="line">        <span class="keyword">if</span>(<span class="keyword">this</span>.orderIdstr.contains(<span class="string">"_"</span>)) &#123;</span><br><span class="line">            orderId = Long.parseLong(<span class="keyword">this</span>.orderIdstr.split(<span class="string">"_"</span>)[<span class="number">1</span>]);</span><br><span class="line">            <span class="keyword">if</span> (!<span class="keyword">this</span>.orderIdstr.split(<span class="string">"_"</span>)[<span class="number">0</span>].equals(prefix)) &#123;</span><br><span class="line">                <span class="keyword">throw</span> <span class="keyword">new</span> ApiNotFoundException(<span class="string">"order format error;not find orderId:"</span>+<span class="keyword">this</span>.orderIdstr);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">WeixinNotify</span><span class="params">(HttpServletRequest request, String orderPrefix)</span> <span class="keyword">throws</span> IOException, ApiNotFoundException </span>&#123;</span><br><span class="line">        InputStream inStream = request.getInputStream();</span><br><span class="line">        ByteArrayOutputStream outSteam = <span class="keyword">new</span> ByteArrayOutputStream();</span><br><span class="line">        <span class="keyword">byte</span>[] buffer = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">1024</span>];</span><br><span class="line">        <span class="keyword">int</span> len = <span class="number">0</span>;</span><br><span class="line">        <span class="keyword">while</span> ((len = inStream.read(buffer)) != -<span class="number">1</span>) &#123;</span><br><span class="line">            outSteam.write(buffer, <span class="number">0</span>, len);</span><br><span class="line">        &#125;</span><br><span class="line">        outSteam.close();</span><br><span class="line">        inStream.close();</span><br><span class="line">        <span class="keyword">this</span>.xmlDoc  = <span class="keyword">new</span> String(outSteam.toByteArray(),<span class="string">"utf-8"</span>);</span><br><span class="line">        logger.info(<span class="keyword">this</span>.xmlDoc);</span><br><span class="line"></span><br><span class="line">        StringReader read = <span class="keyword">new</span> StringReader(xmlDoc);</span><br><span class="line">        InputSource source = <span class="keyword">new</span> InputSource(read);</span><br><span class="line">        SAXBuilder sb = <span class="keyword">new</span> SAXBuilder();</span><br><span class="line">        Document doc = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            doc = sb.build(source);</span><br><span class="line">        &#125; <span class="keyword">catch</span> (JDOMException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="comment">//取的根元素</span></span><br><span class="line">        root = doc.getRootElement();</span><br><span class="line">        <span class="comment">//            System.out.println(root.getName());//输出根元素的名称（测试）</span></span><br><span class="line">        Namespace ns = root.getNamespace();</span><br><span class="line"></span><br><span class="line">        <span class="comment">//获取 orderId</span></span><br><span class="line"></span><br><span class="line">        <span class="comment">//            logger.info("--------------------wxpayNotify----prefix----"+prefix);</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">this</span>.orderIdstr= root.getChild(<span class="string">"out_trade_no"</span>,ns).getText();</span><br><span class="line">        <span class="keyword">this</span>.payAccount = root.getChild(<span class="string">"openid"</span>,ns).getText();</span><br><span class="line">        <span class="keyword">this</span>.tradeNo= root.getChild(<span class="string">"transaction_id"</span>,ns).getText();</span><br><span class="line"></span><br><span class="line">        <span class="comment">//可以从订单号中区分 是单行本 还是  app</span></span><br><span class="line">        <span class="keyword">if</span>(<span class="keyword">this</span>.orderIdstr.contains(<span class="string">"_"</span>)) &#123;</span><br><span class="line">            orderId = Long.parseLong(<span class="keyword">this</span>.orderIdstr.split(<span class="string">"_"</span>)[<span class="number">1</span>]);</span><br><span class="line">            <span class="keyword">if</span> (!<span class="keyword">this</span>.orderIdstr.split(<span class="string">"_"</span>)[<span class="number">0</span>].equals(orderPrefix)) &#123;</span><br><span class="line">                <span class="keyword">throw</span> <span class="keyword">new</span> ApiNotFoundException(<span class="string">"order format error;not find orderId:"</span>+<span class="keyword">this</span>.orderIdstr);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getOrderIdstr</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> orderIdstr;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getPayAccount</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> payAccount;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getXmlDoc</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> xmlDoc;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> Element <span class="title">getRoot</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> root;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getTradeNo</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">if</span>(tradeNo==<span class="keyword">null</span>)&#123;</span><br><span class="line">            <span class="keyword">return</span> <span class="string">""</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> tradeNo;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> Long <span class="title">getOrderId</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> orderId;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 微信验签</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> true成功 false失败</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">checkWeixinSign</span><span class="params">(WeixinNotify weixinNotify,String appid,String wxkey,String mch_id)</span></span>&#123;</span><br><span class="line"></span><br><span class="line">        <span class="comment">//参数：开始生成签名</span></span><br><span class="line">        SortedMap&lt;Object,Object&gt; parameters = <span class="keyword">new</span> TreeMap&lt;Object,Object&gt;();</span><br><span class="line">        List&lt;Element&gt; alle=weixinNotify.getRoot().getChildren();</span><br><span class="line"></span><br><span class="line">        Namespace namespace = weixinNotify.getRoot().getNamespace();</span><br><span class="line"></span><br><span class="line">        System.out.println(alle.get(<span class="number">1</span>));</span><br><span class="line">        <span class="keyword">for</span>(<span class="keyword">int</span> i=<span class="number">0</span>;i&lt;alle.size();i++)&#123;</span><br><span class="line">            <span class="comment">//Element sstr=alle.get(i);</span></span><br><span class="line">            String key=alle.get(i).getName();</span><br><span class="line">            <span class="keyword">if</span>(key.equals(<span class="string">"sign"</span>) || key.equals(<span class="string">"appid"</span>)  || key.equals(<span class="string">"mch_id"</span>) )&#123;</span><br><span class="line">                <span class="keyword">continue</span>;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="comment">//System.out.println(sstr.getName());</span></span><br><span class="line">            parameters.put(key, weixinNotify.getRoot().getChild(key,namespace).getText());</span><br><span class="line">        &#125;</span><br><span class="line">        parameters.put(<span class="string">"appid"</span>, appid);</span><br><span class="line">        parameters.put(<span class="string">"mch_id"</span>, mch_id);</span><br><span class="line">        <span class="comment">//生成签名</span></span><br><span class="line">        String sign = WXSignUtils.createSign(<span class="string">"UTF-8"</span>, parameters,wxkey);</span><br><span class="line">        logger.info(<span class="string">"签名是："</span>+sign);</span><br><span class="line">        logger.info(<span class="string">"返回签名是："</span>+weixinNotify.getRoot().getChild(<span class="string">"sign"</span>,namespace).getText());</span><br><span class="line">        <span class="keyword">if</span>(!sign.equals(weixinNotify.getRoot().getChild(<span class="string">"sign"</span>,namespace).getText()))&#123;<span class="comment">//验签失败</span></span><br><span class="line">        <span class="comment">//            logger.info("fail");</span></span><br><span class="line"></span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">true</span>;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>生成签名</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">   <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> String <span class="title">createSign</span><span class="params">(String characterEncoding,SortedMap&lt;Object,Object&gt; parameters,String key)</span></span>&#123;</span><br><span class="line">	StringBuffer sb = <span class="keyword">new</span> StringBuffer();</span><br><span class="line">	Set es = parameters.entrySet();<span class="comment">//</span></span><br><span class="line">	Iterator it = es.iterator();</span><br><span class="line">	<span class="keyword">while</span>(it.hasNext()) &#123;</span><br><span class="line">		Map.Entry entry = (Map.Entry)it.next();</span><br><span class="line">		String k = (String)entry.getKey();</span><br><span class="line">		Object v = entry.getValue();</span><br><span class="line">		<span class="keyword">if</span>(<span class="keyword">null</span> != v &amp;&amp; !<span class="string">""</span>.equals(v) </span><br><span class="line">				&amp;&amp; !<span class="string">"sign"</span>.equals(k) &amp;&amp; !<span class="string">"key"</span>.equals(k)) &#123;</span><br><span class="line">			sb.append(k + <span class="string">"="</span> + v + <span class="string">"&amp;"</span>);</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line">	sb.append(<span class="string">"key="</span> + key);</span><br><span class="line">	System.out.println(<span class="string">"字符串拼接后是"</span>+sb.toString());</span><br><span class="line">	String sign = MD5Util.MD5Encode(sb.toString(), characterEncoding).toUpperCase();</span><br><span class="line">	<span class="keyword">return</span> sign;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2018/11/06/微信支付/" data-id="ck8l06c2b007gxouwo0gbuhdq" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/支付转账/">支付转账</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2018/11/07/即时到账交易接口/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Newer</strong>
      <div class="article-nav-title">
        
          即时到账 ali
        
      </div>
    </a>
  
  
    <a href="/2018/11/06/支付宝支付/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Older</strong>
      <div class="article-nav-title">aliPay</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/Design-Patterns/">Design Patterns</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Git/">Git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Html/">Html</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Http/">Http</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Sort/">Sort</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/algorithm/">algorithm</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/docker/">docker</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/elasticsearch/">elasticsearch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/idea/">idea</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/jvm/">jvm</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/logstash/">logstash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mysql/">mysql</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/php/">php</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pytest/">pytest</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/springboot/">springboot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/util/">util</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vue/">vue</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wechat/">wechat</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/我的世界/">我的世界</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/支付转账/">支付转账</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/消息队列/">消息队列</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/简单算法题/">简单算法题</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/线程/">线程</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/Design-Patterns/" style="font-size: 16.36px;">Design Patterns</a> <a href="/tags/Git/" style="font-size: 10px;">Git</a> <a href="/tags/Html/" style="font-size: 10px;">Html</a> <a href="/tags/Http/" style="font-size: 12.73px;">Http</a> <a href="/tags/JavaScript/" style="font-size: 15.45px;">JavaScript</a> <a href="/tags/Sort/" style="font-size: 18.18px;">Sort</a> <a href="/tags/algorithm/" style="font-size: 10.91px;">algorithm</a> <a href="/tags/docker/" style="font-size: 17.27px;">docker</a> <a href="/tags/elasticsearch/" style="font-size: 10px;">elasticsearch</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/idea/" style="font-size: 10px;">idea</a> <a href="/tags/java/" style="font-size: 20px;">java</a> <a href="/tags/jvm/" style="font-size: 11.82px;">jvm</a> <a href="/tags/linux/" style="font-size: 13.64px;">linux</a> <a href="/tags/logstash/" style="font-size: 12.73px;">logstash</a> <a href="/tags/mysql/" style="font-size: 14.55px;">mysql</a> <a href="/tags/php/" style="font-size: 11.82px;">php</a> <a href="/tags/pytest/" style="font-size: 10px;">pytest</a> <a href="/tags/python/" style="font-size: 13.64px;">python</a> <a href="/tags/springboot/" style="font-size: 17.27px;">springboot</a> <a href="/tags/util/" style="font-size: 19.09px;">util</a> <a href="/tags/vue/" style="font-size: 10px;">vue</a> <a href="/tags/wechat/" style="font-size: 10.91px;">wechat</a> <a href="/tags/我的世界/" style="font-size: 10px;">我的世界</a> <a href="/tags/支付转账/" style="font-size: 13.64px;">支付转账</a> <a href="/tags/消息队列/" style="font-size: 10.91px;">消息队列</a> <a href="/tags/简单算法题/" style="font-size: 10px;">简单算法题</a> <a href="/tags/线程/" style="font-size: 11.82px;">线程</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/03/">March 2020</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">October 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">August 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">June 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/04/">April 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">March 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/02/">February 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/01/">January 2019</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">December 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/11/">November 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/10/">October 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/09/">September 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/07/">July 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">June 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/05/">May 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">April 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/03/">March 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/">February 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/">January 2018</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/12/">December 2017</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2020/03/29/UML/">UML</a>
          </li>
        
          <li>
            <a href="/2020/03/29/hello-world/">Hello World</a>
          </li>
        
          <li>
            <a href="/2019/10/27/python_字典/">python_dict</a>
          </li>
        
          <li>
            <a href="/2019/10/27/python_时间/">python-时间</a>
          </li>
        
          <li>
            <a href="/2019/10/26/git取消修改/">git-取消修改</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2020 chen v<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>



  </div>
</body>
</html>